<extend name="Public:base" />
<block name="content">
  <style type="text/css">
         #footer .footer-sidebar, #copyright .inner { border-color:#D1D2D2; }
         #slider ul li .slider-caption h2 a, #slider ul li .slider-caption h2 a:hover {color:#fff;}       
         #content { width:750px; }
         #sidebar { width:170px; }        
         #sidebar.shop { width:170px; }
    </style>
<div id="primary" class="inner group">
   <div class="layout-sidebar-left group">
      <div id="container">
         <div id="content" role="main">
            <div id="breadcrumb"><a class="home" href="home.html">Home</a>  › <a href="shop.html">Shop</a></div>
            <h1 class="page-title">All Products</h1>
            <h2></h2>
            <ul class="products">
               <li id="li" class="product border shadow" style="margin-top:20px;display:none">
                  <a href="/home/goods/detail/index/id/{$v6['id']}">
                     <div class="thumbnail">
                        <img width="150" height="150" src="{$v6['zpic']}" class="attachment-shop_small wp-post-image" alt="001" title="001">    			
                        <div class="thumb-shadow"></div>
                        <strong class="below-thumb">{$v6.goods_name}</strong>
                     </div>
                     <span class="price">${$v6.goods_price}.00</span>		
                  </a>
                  <div class="buttons">
                     <a href="/home/goods/detail/index/id/{$v6['id']}" class="details">DETAILS</a>&nbsp;<a href="#" info="{$v6.id}" class="add-to-cart">ADD TO CART</a>
                  </div>
               </li>
            </ul>
            <div class="clear"></div>
         </div>
      </div>
      <div id="sidebar" class="shop group">
         <div id="product_categories-3" class="widget-1 widget-first widget widget_product_categories">
            <h3>类别</h3>
            <ul>
            <foreach name="vo['0']['sub']" item="v5">
               <li class="cat-item cat-item-22">
                  <a href="#" title="View all posts filed under Brand">{$v5.type_name}</a>
                  <ul class="children">
                  <foreach name="v5['sub']" item='val5'>
                     <li class="cat-item cat-item-28"><a href="/home/goods/details/index/id/{$val5.id}" title="View all posts filed under Wallmart">{$val5.type_name}</a></li>
                  </foreach>
                  </ul>
               </li>
            </foreach>
            </ul>
         </div>
         <div id="text-image-3" class="widget-2 widget-last widget text-image">
            <div class="text-image" style="text-align:left"><img src="__PUBLIC__/home/images/free.jpg" alt=""></div>
         </div>
      </div>
   </div>
   <div class="loading"></div>
</div>
<script type="text/javascript">
    $(function(){
      // $('.products').each(function(){
      //    $(this).find('li').each(function(i){
      //       if(i%4==0){
      //          $(this).attr('class','product border shadow first last-row');
      //       }
      //       if(i%4==3){
      //          $(this).attr('class','product border shadow last last-row');
      //       }
      //    });
      // });
      $('#newsletter-form').css('display','none');
      $('#footer').css('display','none');
      $('#copyright').css('display','none');

      var p=1;
   var flag = false;
   getPic();
   function getPic(){
      
      flag=true;
      $.ajax({
      url:'/home/goods/details/data',
      data:{'p':p},
      type:'post',
      dataType:'json',
      success:function(mes){
         //[{},{}]
         if($(mes).length!=12){
            $('.loading').css('display','none');
         }
         // alert(typeof(mes));
            $(mes).each(function(i){
               var li = $('#li').clone(true);
               li.css('display','block');
               // console.log($(this).attr('id'));
               li.find('a').attr('href','/home/goods/detail/index/id/'+$(this).attr('id'));
               li.find('.add-to-cart').attr('info',$(this).attr('id'));
               li.find('img').attr('src',$(this).attr('zpic'));
               li.find('.below-thumb').html($(this).attr('goods_name'));
               li.find('.price').html('$'+$(this).attr('goods_price')+'.00');
               if(i%4==0){
                  li.attr('class','product border shadow first last-row');
               }else if(i%4==3){
                  li.attr('class','product border shadow last');
               }
               $('.products').last().append(li);
            });
         },
         async:false
      });
      p++;
      flag=false;
   }
   $(window).scroll(function(){
      if(flag){
         return;
      }
      //判断底部发送请求
      //获取文档的高度
      var dy =$(document).height();
      //浏览器的高度
      var wy =$(window).height();
      //滚动的高度
      var sy =$(window).scrollTop();
      if((dy-wy-sy)<=1){
         getPic();
      }

   });   

    });
    </script>
</block>